﻿@model IndoReputation.Models.BusinessObject.Collections.ViewerTypeList

@{
    ViewBag.Title = "List Viewer Type";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section _Right {
    @Html.Partial("_Right")
}
<h2>List Viewer Type</h2>
<div class="grid-main">
    @(Html.Telerik().Grid(Model)
        .Name("Grid")
        .DataKeys(keys =>
        {
            keys.Add(p => p.ID);
        })
        .ToolBar(toolbar => toolbar.Template(@<text>@item.CustomCommandToolBarButton("insertnew", "Add new Viewer Type", "Add", "ViewerType", null, false, GridButtonType.Text)</text>))
        .Columns(columns =>
        {
            columns.Bound(o => o.No).Width(50);
            columns.Bound(o => o.Name).Width(200);
            columns.Bound(o => o.CreateAt).Format("{0:dd/MM/yyyy}").Width(80);
            columns.Command(commands =>
            {
                commands.Custom("viewDetail")
                    .Text("Edit")
                    .DataRouteValues(route => route.Add(o => o.ID).RouteKey("viewerTypeID"))
                    .Ajax(false)
                    .Action("Edit", "ViewerType")
                    .HtmlAttributes(new { style = "text-align: center" });
                commands.Delete();
            })
            .Width(160);

        })
        .DataBinding(dataBinding =>
        {
            dataBinding.Server().Select("Index", "ViewerType", new { ajax = ViewData["ajax"] });
            dataBinding.Ajax().Select("_Index", "ViewerType").Enabled((bool)ViewData["ajax"])
                .Delete("_DeleteAjaxEditing", "ViewerType");
        })
        .Selectable()
        .Scrollable(scrolling => scrolling.Enabled((bool)ViewData["scrolling"]))
        .Sortable(sorting => sorting.Enabled((bool)ViewData["sorting"]))
        .Pageable(paging => paging.PageSize(20).Enabled((bool)ViewData["paging"]))
        .Filterable(filtering => filtering.Enabled((bool)ViewData["filtering"]))
        .Groupable(grouping => grouping.Enabled((bool)ViewData["grouping"]))
        .Footer((bool)ViewData["showFooter"])
        .ClientEvents(events => events.OnComplete("Assessments_onComplete"))
)
</div>
<script src="@Url.Content("~/Scripts/indo.common.js")" type="text/javascript"></script>